// DlgSelect1.cpp : implementation file
//

#include "stdafx.h"
#include "MagicWand.h"
#include "DlgSelect1.h"
#include "afxdialogex.h"


// CDlgSelect1 dialog

IMPLEMENT_DYNAMIC(CDlgSelect1, CDialog)

CDlgSelect1::CDlgSelect1(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgSelect1::IDD, pParent)
{
	m_Min = 0;
	m_Max = 255;
	m_Cur = 0;
	m_stcselect1 = 0;
}

CDlgSelect1::~CDlgSelect1()
{
}

void CDlgSelect1::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_SLIDER_SELECT1, m_sliderselect1);
	DDX_Text(pDX, IDC_STC_SELECT1, m_stcselect1);
}


BEGIN_MESSAGE_MAP(CDlgSelect1, CDialog)
	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_SELECT1, &CDlgSelect1::OnNMCustomdrawSliderSelect1)
	ON_BN_CLICKED(IDOK, &CDlgSelect1::OnBnClickedOk)
	ON_BN_CLICKED(IDCANCEL, &CDlgSelect1::OnBnClickedCancel)
END_MESSAGE_MAP()


// CDlgSelect1 message handlers


void CDlgSelect1::OnNMCustomdrawSliderSelect1(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_stcselect1 = m_sliderselect1.GetPos();
	UpdateData(FALSE); 
	*pResult = 0;
}


void CDlgSelect1::OnBnClickedOk()
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	CDialog::OnOK();
}


void CDlgSelect1::OnBnClickedCancel()
{
	// TODO: Add your control notification handler code here
	CDialog::OnCancel();
}


// SetSliderRang
void CDlgSelect1::SetSliderRang(int min, int max,int cur)
{
	m_Min = min;
	m_Max = max;
	m_Cur = cur;
}


// GetSelectNum
int CDlgSelect1::GetSelectNum(void)
{
	return m_stcselect1;
}


BOOL CDlgSelect1::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	m_sliderselect1.SetRange(m_Min, m_Max);
	m_sliderselect1.SetTicFreq((m_Max-m_Min)/20);
	m_sliderselect1.SetPos(m_Cur);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}


//BOOL CDlgSelect1::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
//{
//	// TODO: Add your specialized code here and/or call the base class
//
//	return CDialog::Create(lpszTemplateName, pParentWnd);
//}
